<template>
  <el-text v-bind="elProps" :style="elStyles" v-on="elEvents">
    {{ config.props.slot }}
  </el-text>
</template>

<script lang="ts" setup>
import { computed } from "vue";
import type { PropType } from "vue";
import { omit } from "lodash-es";
import type { ComponentType } from "@/materials/index.d";

defineOptions({
  name: "Text",
});

const props = defineProps({
  config: {
    type: Object as PropType<ComponentType>,
    required: true,
  },
});
// 组件要绑定的属性
const elProps = computed(() => omit(props.config.props, ["slot"]));
// 组件要绑定的样式
const elStyles = computed(() => props.config.styles);
// 组件要绑定的事件
const elEvents = computed(() => props.config.events);
</script>
